import config from './config.js'
/**
 *  token的合法性由校验方法维护
 */
export function checkLogin() {
	var token = uni.getStorageSync("token")
	var userImg = uni.getStorageSync("userImg")
	return ('' != token && '' != userImg)
}
/**
 * 校验token的合法性，失效时删除本地缓存
 */
export function verifyTokenExpir() {
	uni.request({
		url: config.apiUrl + '/verifyTokenExpir',
		header: {
			'Authorization': uni.getStorageSync('token') //自定义请求头信息
		},
		data: {},
		method: "POST",
		success: (res) => {
			if (res.data.code != 200) {
				uni.clearStorageSync("token")
				uni.clearStorageSync("userImg")
			}
		}
	});
}